<script id="content" type="text/template">
	<!--<a href="#/user/user_add" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> 添加</a>-->
	
	<!--if{response.merchant_get}-->
	<div class="panel panel-default">
		<div class="panel-body">
			<!--if{response.merchant_get.merchant_logo_image_id}-->
          	<img src="<!--{response.application_config.qiniu_domain+response.merchant_get.merchant_logo_image_id+'?imageView2/1/w/40'}-->">
          	<!--/if-->	
          	<div>商家ID：<!--{response.merchant_get.merchant_id}--></div>
			<div>商家名称：<!--{response.merchant_get.merchant_name}--></div>
			<div>商家简介：<!--{response.merchant_get.merchant_info}--></div>
			<div>创建时间：<!--{WangAho().date("yyyy/MM/dd HH:mm EEE", parseInt(response.merchant_get.merchant_insert_time) * 1000)}--></div>
			<div>操作：<a href="#/merchant/merchant_edit/?id=<!--{response.merchant_get.merchant_id}-->" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</a></div>
		</div>
	</div>
    <!--else-->
    <div class="alert alert-warning alert-dismissible">
		<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		<strong>注意!</strong> 只能在“只查看某一个商家”的情况下添加商家的用户。
	</div>
	<!--/if-->
	
	
	<div class="btn-group">
		<a href="<!--helper {'anchor-query-state'()}-->" class="btn btn-default <!--if{http().anchor.query.state}--><!--else-->active<!--/if-->">全部状态</a>
		<a href="<!--helper {'anchor-query-state'('1')}-->" class="btn btn-default <!--if{http().anchor.query.state == '1'}-->active<!--/if-->">正常</a>
		<a href="<!--helper {'anchor-query-state'('0')}-->" class="btn btn-default <!--if{http().anchor.query.state == '0'}-->active<!--/if-->">封禁</a>
		<a href="<!--helper {'anchor-query-state'('2')}-->" class="btn btn-default <!--if{http().anchor.query.state == '2'}-->active<!--/if-->">待审核</a>
	</div>
	
	<!--if{response.merchant_get}-->
	<button class="btn btn-default merchant_user_add" type="button"><span class="glyphicon glyphicon-plus"></span> 添加</button>
	<!--/if-->
	<button class="btn btn-default" type="button" action-button="unban"><span class="glyphicon glyphicon-ok-circle"></span> 认证成功</button>
	<button class="btn btn-default" type="button" action-button="banned"><span class="glyphicon glyphicon-ban-circle"></span> 认证失败</button>
	<button class="btn btn-danger" type="button" action-button="remove"><span class="glyphicon glyphicon-trash"></span> 删除</button>
	<button class="btn btn-default search" type="button" ><span class="glyphicon glyphicon-filter"></span> 筛选</button>
	<!--if{http().anchor.query.search}--><span class="label label-default">存在筛选</span><!--/if-->
	
	<hr/>
	<table class="table table-striped">
      <thead>
        <tr>
          <th><input type="checkbox" action-table="checkbox-all"></th>	
          <th>#</th>
          
          <th>
          	<!--if{http().anchor.query.sort == "merchant_id_desc"}-->
          	<a href="javascript:;" action-sort="merchant_id_asc"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span>商家用户名称</a>
          	<!--elseif{http().anchor.query.sort == "merchant_id_asc"}-->
          	<a href="javascript:;" action-sort="merchant_id_desc"><span class="glyphicon glyphicon-sort-by-attributes"></span>商家用户名称</a>
          	<!--else-->
          	<a href="javascript:;" action-sort="merchant_id_desc">商家用户名称</a>
          	<!--/if-->
          </th>
          <th>
          	商家用户简介
          </th>
          
          
          <!--if{response.merchant_get}-->
          <!--else-->
          <th>
          	<!--if{http().anchor.query.sort == "merchant_id_desc"}-->
          	<a href="javascript:;" action-sort="merchant_id_asc"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span>商家信息</a>
          	<!--elseif{http().anchor.query.sort == "merchant_id_asc"}-->
          	<a href="javascript:;" action-sort="merchant_id_desc"><span class="glyphicon glyphicon-sort-by-attributes"></span>商家信息</a>
          	<!--else-->
          	<a href="javascript:;" action-sort="merchant_id_desc">商家信息</a>
          	<!--/if-->
          </th>
          <!--/if-->
          
          
          <th>
          	<!--if{http().anchor.query.sort == "user_nickname_desc"}-->
          	<a href="javascript:;" action-sort="user_nickname_asc"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span>用户昵称</a>
          	<!--elseif{http().anchor.query.sort == "user_nickname_asc"}-->
          	<a href="javascript:;" action-sort="user_nickname_desc"><span class="glyphicon glyphicon-sort-by-attributes"></span>用户昵称</a>
          	<!--else-->
          	<a href="javascript:;" action-sort="user_nickname_desc">用户昵称</a>
          	<!--/if-->
          	/
          	<!--if{http().anchor.query.sort == "user_phone_verify_list_desc"}-->
          	<a href="javascript:;" action-sort="user_phone_verify_list_asc"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span>手机信息</a>
          	<!--elseif{http().anchor.query.sort == "user_phone_verify_list_asc"}-->
          	<a href="javascript:;" action-sort="user_phone_verify_list_desc"><span class="glyphicon glyphicon-sort-by-attributes"></span>手机信息</a>
          	<!--else-->
          	<a href="javascript:;" action-sort="user_phone_verify_list_desc">手机信息</a>
          	<!--/if-->
          	
          </th>
          
          <th>
          	<!--if{http().anchor.query.sort == "merchant_user_state_desc"}-->
          	<a href="javascript:;" action-sort="merchant_user_state_asc"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span>状态</a>
          	<!--elseif{http().anchor.query.sort == "merchant_user_state_asc"}-->
          	<a href="javascript:;" action-sort="merchant_user_state_desc"><span class="glyphicon glyphicon-sort-by-attributes"></span>状态</a>
          	<!--else-->
          	<a href="javascript:;" action-sort="merchant_user_state_desc">状态</a>
          	<!--/if-->
          </th>
          
          <th>
          	<!--if{http().anchor.query.sort == "update_time_desc"}-->
          	<a href="javascript:;" action-sort="update_time_asc"><span class="glyphicon glyphicon-sort-by-attributes-alt"></span>更新时间</a>
          	<!--elseif{http().anchor.query.sort == "update_time_asc"}-->
          	<a href="javascript:;" action-sort="update_time_desc"><span class="glyphicon glyphicon-sort-by-attributes"></span>更新时间</a>
          	<!--else-->
          	<a href="javascript:;" action-sort="update_time_desc">更新时间</a>
          	<!--/if-->
          </th>
          
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
      	<!--if{response.list.data.length}-->
      	<!--for{var i in response.list.data}-->
      	<tr>
          <th><input type="checkbox" action-table="checkbox" data-id="<!--{response.list.data[i].merchant_user_id}-->"></th>
          <td><!--{parseInt(i)+1+((parseInt(response.list.page_now) - 1) * response.list.page_size)}--></td>
          
          <td><!--{response.list.data[i].merchant_user_name}--></td>
          <td><div id="tips-<!--{response.list.data[i].merchant_user_id}-->" class="tips" data-title="查看商家用户简介" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 150px;cursor: pointer;" data="<!--{response.list.data[i].merchant_user_info}-->"><!--{response.list.data[i].merchant_user_info}--></div></td>
          
          <!--if{response.merchant_get}-->
          <!--else-->
          <td>
          <!--if{response.list.data[i].merchant_logo_image_id}-->
          <img src="<!--{response.application_config.qiniu_domain+response.list.data[i].merchant_logo_image_id+'?imageView2/1/w/40'}-->">
          <!--/if-->	
          <!--{response.list.data[i].merchant_name}-->
          </td>
          <!--/if-->
          
          <td style="max-width: 200px;">
          	<div style="max-width: 200px;display: inline-block;">
	          <!--if{response.list.data[i].user_logo_image_id}-->
	          <img src="<!--{response.application_config.qiniu_domain+response.list.data[i].user_logo_image_id+'?imageView2/1/w/40'}-->" class="img-circle">
	          <!--/if-->
	          <!--if{response.list.data[i].user_nickname}-->
	          <!--{response.list.data[i].user_nickname}-->
	          <!--else-->
	          <span style="color: #999999;">未设置昵称</span>
	          <!--/if-->
	          <!--if{response.list.data[i].user_phone_verify_list}-->
	          	(<span style="word-wrap:break-word;"><!--{response.list.data[i].user_phone_verify_list}--></span>)
	          <!--else-->
	          <span style="color: #999999;">无认证手机</span>
	          <!--/if-->
          </div>
          </td>
          
          <td>
          <!--if{response.list.data[i].merchant_user_state == 1}-->
          <span class="label label-success">认证成功</span>
          <!--elseif{response.list.data[i].merchant_user_state == 2}-->
          <span class="label label-warning">等待审核</span>
          <!--elseif{response.list.data[i].merchant_user_state == 0}-->
          <span class="label label-danger">认证失败</span>
          <!--else-->
          <span class="label label-default">未知</span>
          <!--/if-->
          </td>
          
          <td><!--{WangAho().date("yyyy/MM/dd HH:mm EEE", parseInt(response.list.data[i].merchant_user_update_time) * 1000)}--></td>
          
          <td>
          	<button class="btn btn-default btn-sm merchant_user_edit" data-id="<!--{response.list.data[i].merchant_user_id}-->" type="button"><span class="glyphicon glyphicon-edit"></span> 编辑</button>
          	<!--if{response.merchant_get}-->
            <!--else-->
          	<a href="#/merchant/user_list/?search=%257B%2522merchant_id%2522%253A%2522<!--{response.list.data[i].merchant_id}-->%2522%257D" class="btn btn-default btn-sm">
          	<span class="glyphicon glyphicon-filter"></span> 只查看该商家的用户
          	</a>
          	<!--/if-->
          </td>
        </tr>
        <!--/for-->
      	<!--else-->
        <tr>
          <td colspan="10" align="center">无数据</td>
        </tr>
        <!--/if-->
      </tbody>
    </table>
    
    
    
    <!--if{response.list.data.length}-->
	<div class="paging" style="text-align: center;">
		<button class="first btn btn-default <!--if helper{"is_first_page" (response.list.page_now)}-->disabled<!--/if-->" data-page="1" type="button">首页</button>
		<button class="previous btn btn-default <!--if helper{"is_first_page" (response.list.page_now)}-->disabled<!--/if-->" data-page="<!--{parseInt(response.list.page_now) - 1}-->" type="button">上一页</button>
		<button class="btn btn-default" type="button">
			第<!--{response.list.page_now}-->页
			/ 共<!--{response.list.page_count}-->页
			/ 有<!--{response.list.row_count}-->条数据</button>
		<button class="next btn btn-default <!--if helper{"is_end_page" (response.list.page_now, response.list.page_count)}-->disabled<!--/if-->" type="button" data-page="<!--{parseInt(response.list.page_now) + 1}-->">下一页</button>
		<button class="end btn btn-default <!--if helper{"is_end_page" (response.list.page_now, response.list.page_count)}-->disabled<!--/if-->" type="button" data-page="<!--{response.list.page_count}-->">尾页</button>
	</div>
	<div class="form-inline" style="text-align: center;margin-top: 10px;">
		<div class="form-group">
			<input type="text" class="form-control paging--value" placeholder="输入跳转页" style="width: 100px;">
		</div>
		<button type="button" class="btn btn-default paging--submit">跳转</button>
	</div>
	<!--/if-->
	
	
</script>



<script id="add" type="text/template">
	<div style="padding: 10px;width: 500px;">
		<div class="form-group">
	    	<label>输入用户ID或者用户手机号：</label>
	    	<input type="text" class="form-control" placeholder="输入用户ID或者用户手机号" name="user">
	  	</div>
		<div class="form-group">
		    <label>商家用户名称：</label>
		    <input type="text" class="form-control" placeholder="输入商家用户名称" name="merchant_user_name">
		</div>
		<div class="form-group">
		    <label>商家用户简介：</label>
		    <textarea class="form-control" rows="3" placeholder="输入商家用户简介" name="merchant_user_info"></textarea>
		</div>
		
	  	<div class="form-group">
	    	<label>状态：</label>
		  	<select class="form-control" name="merchant_user_state">
				<option value="0">封禁</option>
				<option value="1" selected="selected">正常</option>
				<option value="2" >审核</option>
			</select>
		</div>
	  	
		<div class="form-group">
		    <label>商家ID：</label>
		    <input type="text" class="form-control" readonly="readonly" value="<!--{response.merchant_get.merchant_id}-->" >
		</div>
		
		<br/>
		<button type="button" class="btn btn-primary btn-block" name="add-submit">确定添加</button>
	</div>
</script>



<script id="edit" type="text/template">
	<div style="padding: 10px;width: 500px;">
		<div class="form-group">
		    <label>商家用户ID：</label>
		    <input type="text" class="form-control" name="merchant_user_id" readonly="readonly" value="<!--{merchant_user.merchant_user_id}-->">
		</div>
		<div class="form-group">
		    <label>商家用户名称：</label>
		    <input type="text" class="form-control" placeholder="输入商家用户名称" name="merchant_user_name" value="<!--{merchant_user.merchant_user_name}-->">
		</div>
		<div class="form-group">
		    <label>商家用户简介：</label>
		    <textarea class="form-control" rows="3" placeholder="输入商家用户简介" name="merchant_user_info"><!--{merchant_user.merchant_user_info}--></textarea>
		</div>
		
		<div class="form-group">
	    	<label>状态：</label>
		  	<select class="form-control" name="merchant_user_state">
		  		<option value="0" <!--if{merchant_user.merchant_user_state == "0"}-->selected="selected"<!--/if--> >封禁</option>
		  		<option value="1" <!--if{merchant_user.merchant_user_state == "1"}-->selected="selected"<!--/if--> >正常</option>
		  		<option value="2" <!--if{merchant_user.merchant_user_state == "2"}-->selected="selected"<!--/if--> >审核</option>
			</select>
		</div>
		<div class="form-group">
	    	<label>用户ID：</label>
	    	<input type="text" class="form-control" readonly="readonly" value="<!--{merchant_user.user_id}-->">
	  	</div>
		<div class="form-group">
		    <label>商家ID：</label>
		    <input type="text" class="form-control" readonly="readonly" value="<!--{merchant_user.merchant_id}-->" >
		</div>
		
		<br/>
		<button type="button" class="btn btn-primary btn-block" name="edit-submit">确定编辑</button>
	</div>
</script>




<script id="search" type="text/template">
	<div style="padding: 10px;width: 500px;">
		<div class="form-group">
		    <label>商家用户名称：</label>
		    <input type="text" class="form-control" search placeholder="输入要搜索的商家用户名称" name="merchant_user_name" value="<!--{search.merchant_user_name}-->">
		</div>
		<div class="form-group">
		    <label>用户ID：</label>
		    <input type="text" class="form-control" placeholder="输入要搜索的用户ID" name="user_id" value="<!--{search.user_id}-->">
		</div>
		<div class="form-group">
		    <label>用户手机号：</label>
		    <input type="text" class="form-control" placeholder="输入要搜索的用户手机号" name="user_phone" value="<!--{search.user_phone}-->">
		</div>
		<div class="form-group">
		    <label>用户昵称：</label>
		    <input type="text" class="form-control" placeholder="输入要搜索的用户名称" name="user_nickname" value="<!--{search.user_nickname}-->">
		</div>
		<div class="form-group">
		    <label>商家ID：</label>
		    <input type="text" class="form-control" placeholder="输入要搜索的商家ID" name="merchant_id" value="<!--{search.merchant_id}-->">
		</div>
		<div class="form-group">
		    <label>商家名称：</label>
		    <input type="text" class="form-control" placeholder="输入要搜索的商家名称" name="merchant_name" value="<!--{search.merchant_name}-->">
		</div>
		<br/>
		<div class="btn-group" style="width: 100%;">
			<button type="button" class="btn btn-primary" style="width: 50%;" name="search-submit">确定筛选</button>
			<button type="button" class="btn btn-default" style="width: 50%;" name="search-clear">清理筛选</button>
		</div>
	</div>
</script>

